#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTcpServer>
#include <QTcpSocket>
#include <QTime>
#include <stdio.h>
#include <string.h>
#include <iostream>
using namespace std;

#define MOUSEMOVE 1
#define MOUSEDOWN 2
#define MOUSERELEASE 3
#define MOUSE_DCLICK 4
#define MOUSE_RIGHTCLICK 5

#include <form.h>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    Form display;

    void setBtnPos(int x, int y);


    void server_recv(char recvBuf[]);

    void getPos(char src[], int &x, int &y);
    bool cmp_str(const char src[], const char dst[]);

    void setMouse(int x, int y, int type);

    void mouseRelaseProc(int x, int y);

private slots:
    void on_btn_clicked();

    void on_btn_2_clicked();

    void on_btn_3_clicked();

    void on_btn_4_clicked();

    void on_btn_5_clicked();

    void on_btn_6_clicked();
    
private:
    Ui::MainWindow *ui;
    QTcpSocket  *tcpSocket;//通信套接字

    bool mode;
    bool subMode;
    bool netShow;
    bool isOpen;

    int recvLen;
    char recvBuf[64];
    int serverWidth;
    int serverHight;
    int startX;
    int startY;
    int showW;
    int showH;
    int lastX,lastY;
    int mouseState;
    QTime startTime;

    int ownX,ownY;
    int recvLastX,recvLastY;
};

#endif // MAINWINDOW_H
